﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SupervisorModel;
using SupervisorInterfaces;

namespace SupervisorController
{
    public class Cls_SupervisorController
    {
        Cls_GroupCollection groupColl;
        Cls_ProgramCollection programColl;
        Cls_AccessCollection accessCollection;
        Cls_Message message;

        public Cls_SupervisorController()
        {
            groupColl = new Cls_GroupCollection();
            programColl = new Cls_ProgramCollection();
            accessCollection = new Cls_AccessCollection();
            message = new Cls_Message();
        }

        public bool CreateMessage(string broadcastMessage, string groupName)
        {
            return message.CreateMessage(broadcastMessage, groupName);
        }

        public bool CreateGroup(string groupName)
        {
            return groupColl.CreateGroup(groupName);
        }

        public void AddToStandardPackage(string name, string path)
        {
            programColl.listPrograms.Add(new Cls_Program(name, path));
            //List<ICls_Program> listInterfacePrograms;
            //foreach (var item in programColl.listPrograms)
            //{
            //    listInterfacePrograms.Add(item);
            //}

            //return listInterfacePrograms;
        }

        public void DeleteFromStandardPackage(string name, string path)
        {
            programColl.listPrograms.Remove(new Cls_Program(name, path));
        }

        public bool ChangePassword(string oldPassword, string newPassword)
        {
            return accessCollection.ChangePassword(oldPassword, newPassword);
        }
    }
}
